<?php
session_start();
$loginId=$_SESSION['loginid'];
$name=$_SESSION['name'];
$userType=$_SESSION['user_type'];

include("connection/connection.php");
$tanker_id=$_REQUEST['var'];
$qrTanker="select * from tbl_dtls_q2_tanker where id='$tanker_id'";
		$resTanker=mysql_query($qrTanker);
		$rowTanker=mysql_fetch_array($resTanker);
		$frm=$rowTanker['q2_id'];
?>
<script type="text/javascript">
function float2dec(field)
{	
	var value1 = field.value;
	if(isNaN(value1))
	{
		alert("Invalid entry! Only integer and decimal values are accepted!");
		field.value="";
		field.focus();
		return false;
	}
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{2}$/.test(value1))
		{
			alert("Number should be two digit after decimal");
			field.value="";
			field.focus();
			return false;
		}
	}	
}

function float(field)
{	
	var value1 = field.value;
	if(isNaN(value1))
	{
		alert("Invalid entry! Only integer values are accepted!");
		field.value="";
		field.focus();
		return false;
	}
	if(value1.indexOf(".") != -1)
	{
	alert("Invalid entry! Only integer values are accepted!");
	field.value="";
	field.focus();
	return false;

	}
}

</script>
 <div class="section_format">
  <form action="tanker_edit_q2.php" method="post" name="sampleform" id="sampleform">
  <table border="1">
    
    <tr>
      <td colspan="2">&nbsp;<b>Water Supply by Tankers</b>&nbsp;</td>
      </tr>
   
      <td width="400">&nbsp;<b>Tanker Nos.</b></td>
      <td width="400">&nbsp;<input type="text" name="tank_no" id="tank_no" value="<?php echo $rowTanker['total_tanker_no'];?>" onblur="float(this);" /><input type="hidden" id="tankId" name="tankId" value="<?php echo $tanker_id; ?>">
	  <input type="hidden" name="frmId" id="frmId" value="<?php echo $frm;?>" />
	  <input type="hidden" name="loginId" id="loginId" value="<?php echo $loginId;?>" />
	  <input type="hidden" name="name" id="name" value="<?php echo $name;?>" />
	  <input type="hidden" name="userType" id="userType" value="<?php echo $userType;?>" />
	  
	  </td>
      </tr>
    <tr>
      <td>&nbsp;<b>Quantity (KL)</b></td>
      <td>&nbsp;<input type="text" name="qty" id="qty" value="<?php echo $rowTanker['water_quantity'];?>" onblur="float2dec(this);" /></td>
      </tr>
	  <tr>
      <td>&nbsp;<b>Area Covered</b></td>
      <td>&nbsp;<input type="text" name="area" id="area" value="<?php echo $rowTanker['area_covered'];?>" /></td>
      </tr>
	  <tr>
        <td >&nbsp;<b>To Date</b></td>
	    <td >&nbsp;
	        <input type="text" id="firstinput" name="firstinput" value="<?php echo $rowTanker['to_date']; ?>" readonly >&nbsp;
	     <a href="javascript:showCal('Calendar1')"><img src="images/caldr.jpg" /></a></td>
      </tr>
	  <tr>
        <td >&nbsp;<b>From Date</b></td>
	    <td >&nbsp;
	        <input type="text" id="secondinput" name="secondinput" value="<?php echo $rowTanker['from_date']; ?>" readonly >&nbsp;<a href="javascript:showCal('Calendar2')"><img src="images/caldr.jpg" /></a></td>
      </tr>
	  
	   
    <tr>
	    <td colspan="2" align="center"><input type="submit" value="EDIT" name="tanker_info" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px; font-weight:bold; background:#666666; color:#FFFFFF; width:140px; height:30px" onClick="view_validate()"></td>
  </tr>
  </table>
  </form>
  </div>